function pagination(target, index, count, url) {
    var start=1;
    var end;
    var i;
    if(index<1) index=1;
    if(index-3>0) start=index-3;
    end=start+6;
    if(end>count) end=count;

    target.append(newLi(index,index,"active"));
    for(i=index-1;i>=start;i--){
        target.prepend(newLi(i,i));
    }
    for (i=index+1;i<=end;i++){
        target.append(newLi(i,i));
    }
    if(index>4){
        if(index != 5 )target.prepend(newLi(0,"...","disabled"));
        target.prepend(newLi(1,1));
    }
    if(index>1) target.prepend(newLi(index-1,"上一页"));
    else target.prepend(newLi(index-1,"上一页","disabled"));


    if(end<count){
        if(end+1<count) target.append(newLi(0,"...","disabled"));
        target.append(newLi(count,count));
    }
    if(index<count) target.append(newLi(index+1,"下一页"));
    else target.append(newLi(index+1,"下一页","disabled"));

    function newLi(index,content,active) {
        return "<li class='page-item "+active+"'><a class='page-link' href='"+url+index+"'>"+content+"</a></li>";
    }
}